/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ronin.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author esimsek
 */
@Entity
@Table(name = "arac")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Arac.findAll", query = "SELECT a FROM Arac a"),
    @NamedQuery(name = "Arac.findById", query = "SELECT a FROM Arac a WHERE a.id = :id"),
    @NamedQuery(name = "Arac.findByPlaka", query = "SELECT a FROM Arac a WHERE a.plaka = :plaka")})
public class Arac implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "plaka")
    private String plaka;
    @JoinColumn(name = "musteri_id", referencedColumnName = "id")
    @ManyToOne
    private Musteri musteri;
    
    @Version
    private int versiyon;

    public Arac() {
    }

    public Arac(Long id) {
        this.id = id;
    }

    public Arac(Long id, String plaka) {
        this.id = id;
        this.plaka = plaka;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPlaka() {
        return plaka;
    }

    public void setPlaka(String plaka) {
        this.plaka = plaka;
    }

    public Musteri getMusteri() {
        return musteri;
    }

    public void setMusteri(Musteri musteri) {
        this.musteri = musteri;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Arac)) {
            return false;
        }
        Arac other = (Arac) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ronin.model.Arac[ id=" + id + " ]";
    }

    public int getVersiyon() {
        return versiyon;
    }

    public void setVersiyon(int versiyon) {
        this.versiyon = versiyon;
    }
    
    
}
